<?php

namespace App\Http\Controllers;


use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Request;
use ServiceClass\About;
//use Illuminate\Contracts\Redis;
use Redis;
//use Illuminate\Contracts\Redis;
//use Illuminate\Support\Facades\Redis;

class AboutController extends Controller
{

    public function __construct(About $about){
        $this->about = $about;
    }

    public function getAbout()
    {
        $result = $this->about->getAbout();

        if ($result == 0) {

            return json_encode(['msg'=>'服务器错误']);
        } else {


            return json_encode($result);
        }
    }


    public function updateAbout(){


        $input = Request::only('about_text','about_shortContent');
        $aboutText = $input['about_text'];
        $aboutShortContent = $input['about_shortContent'];

        $result = $this->about->updateAbout($aboutText,$aboutShortContent);
        if($result == 1){

            return json_encode(['msg'=>'修改成功']);
        }else{

            return json_encode(['msg'=>'修改失败']);
        }

    }
//    public function index(){
//        //连接本地的 Redis 服务
//        $redis = new Redis();
//        $redis->connect('60.205.189.88', 6379);
//        echo "Connection to server sucessfully";
//        //查看服务是否运行
//        echo "Server is running: " . $redis->ping();
//    }
}
